package com.example.feign;

import com.example.domain.Student;

import com.example.feign.impl.FeignHystrixError;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "provider",fallback = FeignHystrixError.class)   //声明要消费的容器接口方法,并可以提供hystrix降级方法
public interface FeignProviderMethods {

    @RequestMapping("/provider/findAll")
    List<Student> findAllStudent();

    @GetMapping("/provider/findById/{id}")
    Student findStudentById(@PathVariable("id") Long id);

    @PostMapping("/provider/save")
    Student saveStudent(@RequestBody Student student);

    @PutMapping("/provider/update")
    Student updateStudent(@RequestBody Student student);

    @DeleteMapping("/provider/deleteById/{id}")
    Boolean deleteStudentById(@PathVariable("id") Long id);

    @RequestMapping("/provider/index")
    String index();

}
